//February 6, 1997
// Notes Application
application "paperroll" called "Notas"

// Notes Soup
soup "Notes" called "Notas" of "paperroll" range "optionalDateRange"

overview "notes:date" called "Por Fecha" of "Notes" queries "timestamp" contains
	{
	column "Fecha" width 115 is timestamp
	column "Ttulo de Nota" width 200 is title
	}

class "paperroll" called "Nota" of "Notes" contains
	{
	data: note called "Nota" with options { "required" "automatic" }
	title: string called "Ttulo"
	timestamp: datetime called "Fecha" default ""
	viewstationery := symbol "paperroll"
	height := value 200
	}
	
class "checkList" called "Tareas" of "Notes" contains
	{
	timestamp: datetime called "Fecha" default ""
	title: string called "Ttulo"
	topics: array called "Temas" with options { "checklistnote" "required" } { entry called "Tema" contains
			{
			mtgdone: boolean called "Marcado" default "O"
			hideCount: integer called "Esconder Cuenta" default "0"
			level: integer called "Nivel" default "1"
			text: text called "Texto" with options { "automatic" }
			viewbounds := bounds { 0 0 200 30 }
			}
		}
	viewstationery := symbol "paperroll"
	height := value 200
	data := nil
	}
	
class "list" called "Sumario" of "Notes" contains
	{
	timestamp: datetime called "Fecha" default ""
	title: string called "Ttulo"
	topics: array called "Temas" with options { "outlinenote" "required" } { entry called "Tema" contains
			{
			hideCount: integer called "Esconder Cuenta" default "0"
			level: integer called "Nivel" default "1"
			text: text called "Texto" with options { "automatic" }
			viewbounds := bounds { 0 0 200 30 }
			}
		}
	viewstationery := symbol "paperroll"
	height := value 200
	data := nil
	}


// Names Application
application "cardfile" called "Nombres"

soup "Names" called "Nombres" of "cardfile" range "textRange"

overview "names:phones" called "Por telfono" of { "cardfile" "Names" } queries "sortOn" contains
	{
	column "Nombre" width 150 is sortOn
	column "Telfono" width 117 is [ phones, 0 ]
	}
	
overview "names:email" called "Por E-Mail" of { "cardfile" "Names" } queries "sortOn" contains
	{
	column "Nombre" width 150 is sortOn
	column "E-Mail" width 117 is email
	}

overview "names:company" called "Por Compaa" of { "cardfile" "Names" } queries "sortOn" contains
	{
	column "Nombre" width 150 is sortOn
	column "Compaa" width 117 is company
	}
	
overview "names:bday" called "Por Cumpleaos" of { "cardfile" "Names" } queries "sortOn" contains
	{
	column "Nombre" width 150 is sortOn
	column "Cumpleaos" width 117 is bday
	}
	
class "Person" called "Persona" of { "cardfile" "Names" } contains
	{
	sortOn := format "%s %s" { name.last name.first }
	name: entry called "Nombre" with options { "required" } contains
		{
		honorific: string called "Sr/Sra" with options { "automatic" }
		first: string called "Primer Nombre" with options { "automatic" }
		last: string called "Apellido" with options { "automatic" }
		}
		
	addresses: set called "Direccin" firststoredin || { entry called "Direccin" contains
			{
			address: string called "Calle"
			address2: string called "Calle2"
			city: string called "Ciudad"
			region: string called "Regin/Estado"
			postal_code: string called "C.P."
			country: string called "Pas"
			}
		}
	
	companies: set called "Compaa" firststoredin || { entry called "Compaa" contains
			{	
			company: string called "Nombre"
			title: string called "Ttulo"
			}
		}
		
	pagers: set called "Pager" { entry called "Pager" contains
			{
			pagerNum: string called "Pager" class "pagerClasses" with options { "titlefromclass" "firstclasswild" }
			pagerPIN: string called "Pager PIN"
			}
		}
		
	phones: set called "Telfono" { string called "Telfono" class "phoneClasses" with options { "titlefromclass" "firstclasswild" } }
	emailAddrs: set called "E-Mail" firststoredin || { entry called "E-Mail" contains
			{
			email: string called "EMail" class "mailClasses" with options { "titlefromclass" "firstclasswild" }
			}
		}
	bday: date called "Cumpleaos"
	anniversary: date called "Anniversario"
	notes: note called "Notas"
	cardType: integer called "Tipo de Tarjea"
	}


class "company" called "Compaa" of { "cardfile" "Names" } contains
	{
	sortOn := format "%s" { company }
	company: string called "Compaa" with options { "required" }
	names: set called "Nombre" firststoredin name { entry called "Nombre" contains
			{
			honorific: string called "Sr/Sra"
			first: string called "Primer Nombre"
			last: string called "Apellido"
			title: string called "Ttulo"
			}
		}
		
	addresses: set called "Direccin" firststoredin || { entry called "Direccin" contains
			{
			address: string called "Calle"
			address2: string called "Calle2"
			city: string called "Ciudad"
			region: string called "Regin"
			postal_code: string called "C.P."
			country: string called "Pas"
			}
		}

	phones: set called "Telfono" { string called "Telfono" class "phoneClasses" with options { "titlefromclass" "firstclasswild" } }
	emailAddrs: set called "E-Mail" firststoredin email { string called "EMail" class "mailClasses" with options { "titlefromclass" "firstclasswild" } }
	notes: note called "Notas"
	cardType: integer called "Tipo de Tarjeta"
	}


class "owner" called "Dueno" of { "cardfile" "Names" } with options { "nofolders" } contains
	{
	labels := symbol "_ownerNames"
	sortOn := format "%s %s" { name.last name.first }
	name: entry called "Nombre" with options { "required" } contains
		{
		honorific: string called "Sr/Sra" with options { "automatic" } 
		first: string called "Primer Nombre" with options { "automatic" } 
		last: string called "Apellido" with options { "automatic" } 
		}
		
	addresses: set called "Direccin" firststoredin || { entry called "Direccin" contains
			{
			address: string called "Calle"
			address2: string called "Calle2"
			city: string called "Ciudad"
			region: string called "Regin/Estado"
			postal_code: string called "C.P."
			country: string called "Pas"
			}
		}
	
	companies: set called "Compaa" firststoredin || { entry called "Compaa" contains
			{	
			company: string called "Nombre"
			title: string called "Ttulo"
			}
		}
		
	pagers: set called "Pager" firststoredin || { entry called "Pager" contains
			{
			pagerNum: string called "Pager" class "pagerClasses" with options { "titlefromclass" "firstclasswild" }
			pagerPIN: string called "Pager PIN"
			}
		}
		
	phones: set called "Telfono" { string called "Telfono" class "phoneClasses" with options { "titlefromclass" "firstclasswild" } }
	emailAddrs: set called "E-Mail" firststoredin || { entry called "E-Mail" contains
			{
			email: string called "EMail" class "mailClasses" with options { "titlefromclass" "firstclasswild" }
			emailpassword: string called "Palabra de paso"
			}
		}
	
	owner: entry called "Informacin del Dueno" contains
			{
			bankAccounts: set called "Cuenta de Banco" { entry called "Cuenta del Banco" contains
					{
					bankAcctNum: string called  "Cuenta"
					bankContactNum: string called "Telfono" class "phoneClasses" with options { "titlefromclass" "firstclasswild" }
					}
				}
				
			creditCards: set called "Tarjeta de Credito" { entry called "Tarjeta de Credito" contains
					{
					creditCardNum: string called "# de Tarjeta"
					creditCardName: string called "Nombre" class "creditClasses" with options { "titlefromclass" "firstclasswild" }
					creditCardExpDate: date called "Fecha de expiracin"
					creditCardContactNum: string called "# de Telfono"
					}
			}
		}
		
	bday: date called "Cumpleaos"
	anniversary: date called "Anniversario"
	notes: note called "Notas"
	cardType: integer called "Tipo de Tarjeta"
	}

class "worksite" called "Trabajo" of { "cardfile" "Names" } with options { "nofolders" } contains
	{
	labels := symbol "_ownerNames"
	sortOn:= format "%s" { place }
	place: string called "Trabajo" with options { "required" }
	areaCode: string called "Codigo de Area"
	dialingPrefix: string called "Prefijo"
	notes: note called "Notas"
	}
	
field class "creditClasses" |string.card| is "Card" ""
field class "creditClasses" |string.card.phonecard| is "Phone Card" ""
field class "creditClasses" |string.card.creditcard| is "Credit Card" ""
field class "creditClasses" |string.card.phonecard.att| is "AT&T" ""
field class "creditClasses" |string.card.phonecard.mci| is "MCI" ""
field class "creditClasses" |string.card.phonecard.sprint| is "Sprint" ""
field class "creditClasses" |string.card.creditcard.visa| is "VISA" ""
field class "creditClasses" |string.card.creditcard.mastercard| is "MasterCard" ""
field class "creditClasses" |string.card.creditcard.amex| is "AmEx" ""
field class "creditClasses" |string.card.creditcard.discover| is "Discover" ""

field class "pagerClasses" |string.pager| is "Pager" ""
field class "pagerClasses" |string.pager.skytel| is "SkyTel" ""
field class "pagerClasses" |string.pager.mobilecomm| is "MobileComm" ""
field class "pagerClasses" |string.pager.embarc| is "EMBARC" ""

field class "phoneClasses" otherPhone is "Telfono" ""
field class "phoneClasses" homePhone is "Hogar" "H"
field class "phoneClasses" workPhone is "Trabajo" "W"
field class "phoneClasses" faxPhone is "Fax" "F"
field class "phoneClasses" carPhone is "Auto" "A"
field class "phoneClasses" mobilePhone is "Cellular" "C"
field class "phoneClasses" homeFaxPhone is "Hogar Fax" "HF"

field class "mailClasses" |string.email| is "Email" ""
field class "mailClasses" |string.email.internet| is "Internet" ""
field class "mailClasses" |string.email.aol| is "America Online" ""
field class "mailClasses" |string.email.compuserve| is "CompuServe" ""
field class "mailClasses" |string.email.mcimail| is "MCI Mail" ""
field class "mailClasses" |string.email.attmail| is "AT&T Mail" ""
field class "mailClasses" |string.email.easylink| is "EasyLink" ""
field class "mailClasses" |string.email.prodigy| is "Prodigy" ""
field class "mailClasses" |string.email.genie| is "GEnie" ""
field class "mailClasses" |string.email.delphi| is "Delphi" ""
field class "mailClasses" |string.email.msn| is "Network" ""
field class "mailClasses" |string.email.interchange| is "Interchange" ""
field class "mailClasses" |string.email.radiomail| is "RadioMail" ""


// Calendar Application
// Note that the calendar application is written using metasoups as the 
// format is too complex and not really documented.
application "calendar" called "Calendario" with options { "nofolders" }

// Calendar Metasoup
metasoup "calendar:metasoup:REVELAR" called "Reuniones" of "calendar" range "dateRange"

overview "meetings:date" called "Por Fecha" of "calendar:metasoup:REVELAR" queries "mtgStartDate" contains
	{
	column "Fecha"width 115 is mtgStartDate
	column "Descripcin" width 200 is mtgText
	}

class "meeting" called "Reunin" of "calendar:metasoup:REVELAR" contains
	{
	mtgStartDate: datetime called "Fecha" with options { "required" }
	mtgText: string called "Titulo" with options { "required" }
	mtgDuration: integer called "Duracin" with options { "required" }
	notes: note called "Notas"
	mtgAlarm: datetime called "Alarma"
	location: string called "Locacin" with options { "readonly" }
	invitees: set called "Invitees" with options { "readonly" }
		{
		string called "Invitee" with options { "readonly" }
		}
	}
	
class "repeatingMeeting" called "Reunin repetida" of "calendar:metasoup:REVELAR" contains
	{
	mtgStartDate: datetime called "Fecha" with options { "required" }
	mtgText: string called "Ttulo" with options { "required" }
	mtgDuration: integer called "Duracin" with options { "required" }
	notes: note called "Notas"
	mtgAlarm: datetime called "Alarma"
	location: string called "Locacin" with options { "readonly" }
	invitees: set called "Invitees" with options { "readonly" }
		{
		string called "Invitee" with options { "readonly" }
		}
	mtgStopDate: date called "Fecha de terminacin"
	repeats: string called "Repetidas" class "repeatClasses" with options { "suffixfromclass" "displayifempty" "required" }
	}
	
class "CribNote" called "Evento" of "calendar:metasoup:REVELAR" contains
	{
	mtgStartDate: date called "Fecha" with options { "required" }
	mtgText: string called "Ttulo" with options { "required" }
	notes: note called "Notas"
	}
	
class "repeatingCribNote" called "Evento repetido" of "calendar:metasoup:REVELAR" contains
	{
	mtgStartDate: date called "Fecha" with options { "required" }
	mtgText: string called "Ttulo" with options { "required" }
	notes: note called "Notas"
	mtgStopDate: date called "Fecha de terminacin"
	repeats: string called "Repetidos" class "repeatClasses" with options { "suffixfromclass" "displayifempty" "required" }
	}
	
field class "repeatClasses" |daily| is "Cada da" "Cada da"
field class "repeatClasses" |weekly| is "Cada semana" "Cada semana"
field class "repeatClasses" |biweekly| is "Cada otra semana" "Cada otra semana"
field class "repeatClasses" |monthly| is "Cada mes" "Cada mes"
field class "repeatClasses" |monthlyByWeek| is "Misma semana cada mes" "Misma semana cada mes"
field class "repeatClasses" |yearly| is "Cada ao" "Cada ao"
field class "repeatClasses" |yearlyByWeek| is "Misma semana cada ao" "Misma semana cada ao"
field class "repeatClasses" |other| is "Otro" ""


// To Do Application
application "todo" called "Cosas que Hacer" with options { "nofolders" "readonly" }

// To Do Soup
soup "To Do List" called "Lista de Cosas que Hacer" of "todo" range "dateRange"

overview "todo:date" called "Por fecha" of "To Do List" queries "date" contains
	{
	column "Fecha" width 115 is date
	}

class "todo" called "Cosa que Hacer" of "To Do List" with options { "readonly" } contains
	{
	|date|: date called "Fecha"
	topics: set called "Artculo" { entry called "Cosas que Hacer" contains
			{
			mtgdone: boolean called "Completado"
			mtgPriority: integer called "Prioridad"
			text: text called "Texto"
			}
		}
	}
	

range "dateRange" called "Hoy" is "<range> [ daystart ... daystart + 1d )"
range "dateRange" called "Esta semana" is "<range> [ weekstart ... weekstart + 1w )"
range "dateRange" called "La Prxima Semana" is "<range> [ weekstart + 1w ... weekstart + 2w )"
range "dateRange" called "Este Mes" is "<range> [ monthstart ... monthstart + 1m )"
range "dateRange" called "Prximos 30 Das" is "<range> [ daystart ... daystart + 30d )"
range "dateRange" called "Prximos 60 Das" is "<range> [ daystart ... daystart + 60d )"
range "dateRange" called "Prximos 90 Das" is "<range> [ daystart ... daystart + 90d )"
range "dateRange" called "Prximos 120 Das" is "<range> [ daystart ... daystart + 120d )"
range "dateRange" called "Prximos 180 Das" is "<range> [ daystart ... daystart + 180d )"
range "dateRange" called "Prximo Ao" is "<range> [ daystart ... daystart + 365d )"
range "dateRange" called "Ultimos 30 Das" is "<range> [ daystart - 30d ... daystart )"
range "dateRange" called "Ultimos 60 Das" is "<range> [ daystart - 60d ... daystart )"
range "dateRange" called "Ultimos 90 Das" is "<range> [ daystart - 90d ... daystart )"
range "dateRange" called "Ultimos 120 Das" is "<range> [ daystart - 120d ... daystart )"
range "dateRange" called "Ultimos 180 Das" is "<range> [ daystart - 180d ... daystart )"
range "dateRange" called "Ultimo Ao" is "<range> [ daystart - 365d ... daystart )"

range "optionalDateRange" called "Todo" is "<range> [ ... ]"
range "optionalDateRange" called "Hoy" is "<range> [ daystart ... daystart + 1d )"
range "optionalDateRange" called "Esta semana" is "<range> [ weekstart ... weekstart + 1w )"
range "optionalDateRange" called "Prxima Semana" is "<range> [ weekstart + 1w ... weekstart + 2w )"
range "optionalDateRange" called "Este Mes" is "<range> [ monthstart ... monthstart + 1m )"
range "optionalDateRange" called "Prximos 30 Das" is "<range> [ daystart ... daystart + 30d )"
range "optionalDateRange" called "Prximos 60 Das" is "<range> [ daystart ... daystart + 60d )"
range "optionalDateRange" called "Prximos 90 Das" is "<range> [ daystart ... daystart + 90d )"
range "optionalDateRange" called "Prximos 120 Das" is "<range> [ daystart ... daystart + 120d )"
range "optionalDateRange" called "Prximos 180 Das" is "<range> [ daystart ... daystart + 180d )"
range "optionalDateRange" called "Prximo Ao" is "<range> [ daystart ... daystart + 365d )"
range "optionalDateRange" called "Ultimos 30 Das" is "<range> [ daystart - 30d ... daystart )"
range "optionalDateRange" called "Ultimos 60 Das" is "<range> [ daystart - 60d ... daystart )"
range "optionalDateRange" called "Ultimos 90 Das" is "<range> [ daystart - 90d ... daystart )"
range "optionalDateRange" called "Ultimos 120 Das" is "<range> [ daystart - 120d ... daystart )"
range "optionalDateRange" called "Ultimos 180 Das" is "<range> [ daystart - 180d ... daystart )"
range "optionalDateRange" called "Ultimo Ao" is "<range> [ daystart - 365d ... daystart )"

range "textRange" called "Todo" is "<range> [ ... ]"
range "textRange" called "#..D" is "<range> [ ... \"E\" )"
range "textRange" called "E..H" is "<range> [ \"E\" ... \"I\" )"
range "textRange" called "I..L" is "<range> [ \"I\" ... \"M\" )"
range "textRange" called "M..P" is "<range> [ \"M\" ... \"Q\" )"
range "textRange" called "Q..T" is "<range> [ \"Q\" ... \"U\" )"
range "textRange" called "U..X" is "<range> [ \"U\" ... \"Y\" )"
range "textRange" called "Y..Z" is "<range> [ \"Y\" ... ]"

// Calls Application
application "callapp" called "Llamadas" with options { "readonly" }

// Calls Soup
soup "Calls" called "Llamada" of "callapp"

overview "calls:date" called "Por Fecha" of "Calls" queries "timestamp" 
contains
	{
	column "Fecha" width 115 is timestamp
	column "Ttulo" width 150 is title
	}
	
class "calllog" called "Llamada" of "Calls" contains
	{
	timestamp: datetime called "Fecha"
	title: string called "Ttulo"
	name: string called "Nombre"
	phoneNumber: string called "Nmero"
	notes: note called "Historia"
	}
